CartView = {
	ctrl: CartController,    

    getListItemId: function() {
        return "cartViewList";
    },

    getNodeItemId: function() {
        return "cartItem";
    },

    displayCartList : function(model) {
        var list = model.list;
        var rootNode = $id(this.getListItemId());

        rootNode.innerHTML = "";
        for(var i = 0; i < list.length;i++) {
            var nodeCart = createDiv();
            nodeCart.id = this.getNodeItemId() + i;
            nodeCart.data = list[i];
            nodeCart.position = i;

            var nodeId = createDiv();
            nodeId.id = this.getNodeItemId() + "Id_" + i;
            nodeId.addClass("cartViewItem");
            nodeId.addClass("cartViewItemId");
            nodeId.setText(list[i].Id);

            var nodeName = createDiv();
            nodeName.id = this.getNodeItemId() + "Name_" + i;
            nodeName.addClass("cartViewItem");
            nodeName.addClass("cartViewItemName");
            nodeName.setText(list[i].Name);

            var nodeAuthor = createDiv();
            nodeAuthor.id = this.getNodeItemId() + "Author_" + i;
            nodeAuthor.addClass("cartViewItem");
            nodeAuthor.addClass("cartViewItemAuthor");
            nodeAuthor.setText(list[i].Author);

            var nodeDes = createDiv();
            nodeDes.id = this.getNodeItemId() + "Des_" + i;
            nodeDes.addClass("cartViewItem");
            nodeDes.addClass("cartViewItemDes");
            nodeDes.setText(list[i].Des);

            var nodePrice = createDiv();
            nodePrice.id = this.getNodeItemId() + "Price_" + i;
            nodePrice.addClass("cartViewItem");
            nodePrice.addClass("cartViewItemPrice");
            nodePrice.setText(list[i].Price);

            var nodeQuantity = createNode("div");
            var nodeQuantityInput = createNode("input");
            nodeQuantityInput.id = this.getNodeItemId() + "QuantityInput_" + i;
            nodeQuantityInput.type = "number";
            nodeQuantityInput.min = "1";
            nodeQuantityInput.value = list[i].Quantity;
            nodeQuantity.id = this.getNodeItemId() + "Quantity_" + i;
            nodeQuantity.addClass("cartViewItem");
            nodeQuantity.addClass("cartViewItemQuantity");
            nodeQuantity.appendChild(nodeQuantityInput);

            var nodeTotal = createDiv();
            nodeTotal.id = this.getNodeItemId() + "Total_" + i;
            nodeTotal.addClass("cartViewItem");
            nodeTotal.addClass("cartViewItemTotal");
            nodeTotal.setText(list[i].getTotal());

            nodeCart.appendChild(nodeId);
            nodeCart.appendChild(nodeName);
            nodeCart.appendChild(nodeAuthor);
            nodeCart.appendChild(nodeDes);
            nodeCart.appendChild(nodePrice);
            nodeCart.appendChild(nodeQuantity);
            nodeCart.appendChild(nodeTotal);

            rootNode.appendChild(nodeCart);
        }

        $id("cartViewTotalNumber").setText(model.getTotal());
    }
};
